package nina.yiyou.attendance.s10merge.compute

import java.time.LocalDateTime
import java.time.temporal.ChronoUnit

/**
 * @see nina.yiyou.attendance.s10merge.input.AttendPunchExcelV2Reader.Line#workingHour
 */
@Deprecated
class WorkingHourCalculator {

  WorkingHourCalculator(LocalDateTime punchIn, LocalDateTime punchOut) {
    _punchIn = punchIn
    _punchOut = punchOut
  }

  Double calc() {
    if (!_punchIn || !_punchOut) {
      return null
    }
    double minute = _punchIn.until(_punchOut, ChronoUnit.MINUTES)
    return (minute / 60d).round(1)
  }

  private final LocalDateTime _punchIn

  private final LocalDateTime _punchOut
}
